home *** CD-ROM | disk | FTP | other *** search
Text File | 2002-06-25 | 73.0 KB | 2,352 lines |
- var IMServiceClass = Components.classes['@netscape.com/aim/IMManager;1'];
- var pIIMManager = IMServiceClass.getService(Components.interfaces.nsIIMManager)
- var lastRadio = null;
- var lastViewRadio = null;
- var allEnums = Components.interfaces.nsAimPrivacyModes;
- var stateEnums = Components.interfaces.nsAimOnlineStates;
- var globalPrivacyObject = pIIMManager.QueryInterface(Components.interfaces.nsIAimPrivacy);
- var MozPreferences = Components.classes['@mozilla.org/preferences-service;1'];
- MozPreferences = MozPreferences.getService();
- MozPreferences = MozPreferences.QueryInterface(Components.interfaces.nsIPrefBranch);
-
- //connection panel
- var connLinks = new Object();
- connLinks.ConnectionName = "";
- connLinks.SessionType = "";
- connLinks.Host = "";
- connLinks.Port = "";
- connLinks.ProxyHost = "";
- connLinks.ProxyPort = "";
- connLinks.ProxyUser = "";
- connLinks.ProxyPassword = "";
- connLinks.ProxyProtocol = "";
- connLinks.IsProxy = false;
- connLinks.ConnectionType = 0;
-
- //end connection panel
-
- function getString(name)
- {
- if (aimStringBundle()){
- return aimStringBundle().GetStringFromName(name);
- }
- else{
- return "";
- }
- }
-
- function EditAwayMessageOnLoad()
- {
- // poke in the arguments
-
- var nameItem = document.getElementById("awayMessageName");
- var textItem = document.getElementById("awayMessageText");
-
- nameItem.value = window.arguments[1];
- textItem.value = window.arguments[2];
- nameItem.focus();
-
- // construct some of the static labels here; had problems placing
- // '%' into an DTD ENTITY
-
- var labelItem = document.getElementById("editAwayMessageSpecial1");
- var stringItem = getString( "editAwayMessageSpecial1" );
- labelItem.setAttribute( "value", stringItem );
- labelItem = document.getElementById("editAwayMessageSpecial2");
- stringItem = getString( "editAwayMessageSpecial2" );
- labelItem.setAttribute( "value", stringItem );
- labelItem = document.getElementById("editAwayMessageSpecial3");
- stringItem = getString( "editAwayMessageSpecial3" );
- labelItem.setAttribute( "value", stringItem );
- labelItem = document.getElementById("editAwayMessageSpecial4");
- stringItem = getString( "editAwayMessageSpecial4" );
- labelItem.setAttribute( "value", stringItem );
-
- // set the OK, Cancel callbacks
-
- if ( nameItem.value == "" )
- doSetOKCancel(AddAwayMessageOnOK, 0);
- else
- doSetOKCancel(EditAwayMessageOnOK, 0);
- }
-
- function PrefIMAwayOnLoad()
- {
- if( (false == IsSignedOn()) || (isIcq() == true) ) {
- var str = getString( "away.entermsg" );
- DisableAwayUI();
- alert( str );
- parent.hPrefWindow.registerOKCallbackFunc(DiscardAwayChanges);
- }
- else {
-
- GetRDFService();
- sidebar_file = GetRdfFileUrl("default-messages.rdf", "dm.rdf");
- datasource = RDF.GetDataSource(sidebar_file);
- var tree = document.getElementById("AwayMessages");
- tree.database.AddDataSource(datasource);
- tree.setAttribute('ref', tree.getAttribute('ref'));
-
- }
-
- }
-
- /*
- * Function: PrefIMStyleOnload ()
- * Arguments:
- * Return: None
- * Description: This function intializes the pref-IM_style.xul panel
- * In paticular the text and background color widgets
- * are filled in and the Special Text Styles are turned
- * on or off depending on the pref.
- *
- * Author: jelwell@netscape.com
- */
- function PrefIMStyleOnload()
- {
- var textData = document.getElementById("textColorData");
- var backgroundData = document.getElementById("backgroundColorData");
- var customTextColor = textData.getAttribute("value");
- var customBackgroundColor = backgroundData.getAttribute("value");
-
- if ( !customBackgroundColor || customBackgroundColor == "")
- customBackgroundColor = "#FFFFFF";
- if ( !customTextColor || customTextColor == "")
- customTextColor = "#000000";
- setColorWell("textCW", customTextColor);
- setColorWell("backgroundCW", customBackgroundColor);
-
- textData.setAttribute("value", customTextColor);
- backgroundData.setAttribute("value", customBackgroundColor);
-
- SwapSpecialStyles();
- }
-
- /*
- * Function: SwapSpecialStyles()
- * Arguments:
- * Return: None
- * Description: This function is used to toggle the special
- * text style checkboxes, on and off depending
- * on the pref and current setting.
- *
- * Author: jelwell@netscape.com
- */
- function SwapSpecialStyles()
- {
- if (document.getElementById("textstyles").getAttribute("value") == "1")
- {
- document.getElementById("bold").removeAttribute("disabled");
- document.getElementById("italics").removeAttribute("disabled");
- document.getElementById("underline").removeAttribute("disabled");
-
- }
- else
- {
- document.getElementById("bold").setAttribute("disabled", "true");
- document.getElementById("italics").setAttribute("disabled", "true");
- document.getElementById("underline").setAttribute("disabled", "true");
-
- }
- }
-
- /*
- * Function: GetColorAndUpdate(ColorWellID)
- * Arguments:
- * ColorWellID -- id of the color spacer inside the button.
- * Return: None
- * Description: This function is used to change the background
- * color of the spacer based on prefs.
- *
- * Author: jelwell@netscape.com
- */
- function GetColorAndUpdate(ColorWellID)
- {
- var colorObj = new Object;
- var colorWell = document.getElementById(ColorWellID);
- var customTextColor = document.getElementById("textColorData").getAttribute("value");
- var customBackgroundColor = document.getElementById("backgroundColorData").getAttribute("value");
- if (!colorWell) return;
-
- // Don't allow a blank color, i.e., using the "default"
- colorObj.NoDefault = true;
-
- switch( ColorWellID )
- {
- case "textCW":
- colorObj.Type = "Text";
- colorObj.TextColor = customTextColor;
- break;
- case "backgroundCW":
- colorObj.Type = "Page";
- colorObj.PageColor = customBackgroundColor;
- break;
- }
-
- window.openDialog("chrome://editor/content/EdColorPicker.xul", "_blank", "chrome,close,titlebar,modal", "", colorObj);
-
- // User canceled the dialog
- if (colorObj.Cancel)
- return;
-
- var color = "";
- switch( ColorWellID )
- {
- case "textCW":
- color = customTextColor = colorObj.TextColor;
- document.getElementById("textColorData").setAttribute("value", color);
- break;
- case "backgroundCW":
- color = customBackgroundColor = colorObj.BackgroundColor;
- document.getElementById("backgroundColorData").setAttribute("value", color);
- break;
- }
- setColorWell(ColorWellID, color);
- // SetColorPreview(ColorWellID, color);
- }
-
-
- // XXXVISHy
- // Add a user to the allow or deny list. top.addMode defines which list
-
- function GetUserAdd()
- {
- var fldUserName = top.document.getElementById("fldUserName");
- var pIAimPrivacy = aimPrivacy();
- var name = fldUserName.value;
- if ( name && name != "" ) {
- if ( top.addMode == "Allow" ) {
- pIAimPrivacy.AllowListAdd( name );
- }
- else if ( top.addMode == "Deny" ) {
- pIAimPrivacy.DenyListAdd( name );
- }
- //pIAimPrivacy.UpdateStorage();
- top.opener.updateListBoxSelection(top.addMode);
- top.window.close();
- }
- }
-
-
-
- function updateListBoxSelection(mode){
- var targetListBox = document.getElementById(mode);
- var targetListBoxSelectedCount = targetListBox.selectedCount
- var targetListBoxRows = targetListBox.listBoxObject.getRowCount();
- if(targetListBoxRows >0 && targetListBoxSelectedCount <1){
- targetListBox.selectedIndex=0;
- }
-
- }
-
- /*
- * Name: StandardURL
- *
- * Arguments: URI string, e.g., chrome://foo/bar
- *
- * Description: obtains an instance of nsIURL and sets the spec to the passed
- * uri. Returns the nsIURL instance.
- *
- */
-
- function StandardURL(s) {
- var clazz = Components.classes["@mozilla.org/network/standard-url;1"];
- var iface = Components.interfaces.nsIURL;
- var obj = clazz.createInstance(iface);
- obj.spec = s;
- return obj;
- }
-
- /*
- * Name: Sound
- *
- * Arguments: none
- *
- * Description: Creates and returns an instance of nsISound
- *
- */
-
- function Sound() {
- var clazz = Components.classes["@mozilla.org/sound;1"];
- var iface = Components.interfaces.nsISound;
- var obj = clazz.createInstance(iface);
- return obj;
- }
-
- /*
- * Name: PlaySound
- *
- * Arguments: chrome URI to a sound file
- *
- * Description: Called by onclick handler for speaker titled buttons in
- * the sound preferences panel for IM.
- *
- */
-
- function PlaySound( myURIPref )
- {
- var sound = new Sound();
- var myURI;
-
- try {
- myURI = aimPrefsManager().GetCharPref( myURIPref , null, false );
- }
- catch(e) {
- try {
- myURI = aimPrefsManager().GetCharPref( myURIPref , null, true); // get the global one if the per screen name doesnt work
- }
- catch(e) {
- return;
- }
- }
-
- var uri = new StandardURL(myURI);
- if ( sound != undefined && sound != null && uri != undefined && uri != null ) {
- try {
- sound.play( uri );
- }
- catch( e ) {
- // device may not support sound, so ignore
- }
- }
- }
-
- /* away messages */
-
- var datasource = null;
- var RDF = null;
- var awayMessages = null;
-
- function
- GetRDFService()
- {
- if ( RDF == null ) {
- RDF=aimRDF();
- }
- }
-
- function
- RemoveTarget( msgName )
- {
- GetRDFService();
-
- var messages_file = GetRdfFileUrl("default-messages.rdf", "dm.rdf");
- var datasource = RDF.GetDataSource(messages_file);
-
- var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance();
- container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
- container.Init(datasource, RDF.GetResource("NC:AIM/AwayMessageBag"));
-
- var elements = container.GetElements();
- var target, node;
- var nameResource =
- RDF.GetResource("http://home.netscape.com/NC-rdf#MsgName");
- while ( elements.hasMoreElements() ) {
- node = elements.getNext();
- if ( node )
- target = datasource.GetTarget( node, nameResource,
- true );
- if ( target )
- target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
- if ( target && target.Value == msgName ) {
- container.RemoveElement( node, true );
- datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
- }
- }
- return null;
- }
-
- function
- SetAwayMessageTarget( msgName, msgText )
- {
- GetRDFService();
-
- var messages_file = GetRdfFileUrl("default-messages.rdf", "dm.rdf");
- var datasource = RDF.GetDataSource(messages_file);
-
- var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance();
- container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
- container.Init(datasource, RDF.GetResource("NC:AIM/AwayMessageBag"));
-
- var elements = container.GetElements();
- var nametarget, texttarget, node;
- var nameResource =
- RDF.GetResource("http://home.netscape.com/NC-rdf#MsgName");
- var textResource =
- RDF.GetResource("http://home.netscape.com/NC-rdf#MsgText");
- while ( elements.hasMoreElements() ) {
- node = elements.getNext();
- if ( node )
- nametarget = datasource.GetTarget( node, nameResource,
- true );
- if ( nametarget )
- nametarget = nametarget.QueryInterface(Components.interfaces.nsIRDFLiteral);
- if ( nametarget && nametarget.Value == msgName ) {
- texttarget = datasource.GetTarget( node, textResource,
- true );
- if ( texttarget )
- texttarget = texttarget.QueryInterface(Components.interfaces.nsIRDFLiteral);
- if ( texttarget ) {
- var newText = RDF.GetLiteral(msgText);
- datasource.Change( node, textResource,
- texttarget, newText);
- datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
- }
- break;
- }
- }
- }
-
- //XXXVISHY - two
-
- function modeToRadio(mode)
- {
-
- switch(mode) {
- case allEnums.AllowAll:
- dump ("allEnums.AllowAll\n" );
- return document.getElementById("aim_privacy_contact_allowallusers");
- break;
- case allEnums.AllowBuddies:
- dump ("allEnums.AllowBuddies\n" );
- return document.getElementById("aim_privacy_contact_allowbuddylistusers");
- break;
- case allEnums.AllowList:
- dump ("allEnums.AllowOnlyList\n" );
- return document.getElementById("aim_privacy_contact_allowonlylist");
- break;
- case allEnums.DenyAll:
- dump ("allEnums.DenyAll\n" );
-
- return document.getElementById("aim_privacy_contact_blockallusers");
- break;
- case allEnums.DenyList:
- dump ("allEnums.DenyList\n" );
- return document.getElementById("aim_privacy_contact_blocklistusers");
- break;
- default:
- dump("Bad privacy mode\n");
- return document.getElementById("aim_privacy_contact_allowallusers");
- break;
- }
- }
-
- function privacyModeRadio(mode)
- {
- dump("privacyModeRadio\n");
-
- // this should not be needed, but believe me dont remove it
- // otherwise radio UI can show two things selected ;-)
- lastRadio.checked = false;
- lastRadio = modeToRadio(mode);
- dump ("lastRadio is " + lastRadio + "\n");
- lastRadio.checked = true;
- parent.lastPrivacyMode = mode;
-
- dump ("lastPrivacyMode is " + parent.lastPrivacyMode + "\n");
- }
-
- function privacyChatInvites(value)
- {
- parent.lastChatInvites = value;
- }
-
- function privacyIdle(value)
- {
- parent.lastIdle = value;
- }
-
-
- function viewToRadio(view)
- {
- dump("in function viewToRadio\n" + view);
-
- switch(view) {
- case '1':
- return document.getElementById("nodisclosure");
- break;
- case '2':
- return document.getElementById("limiteddisclosure");
- break;
- case '3':
- return document.getElementById("fulldisclosure");
- break;
- default:
- dump("Bad privacy view\n");
- return document.getElementById("nodisclosure");
- break;
- }
- }
-
- function privacyViewRadio(view)
- {
- dump("privacyModeRadio\n");
-
- // this should not be needed, but believe me dont remove it
- // otherwise radio UI can show two things selected ;-)
- //lastViewRadio.checked = false;
- //lastViewRadio = viewToRadio(view);
- dump ("lastViewRadio is " + lastViewRadio + "\n");
- //lastViewRadio.checked = true;
- parent.lastPrivacyView = view;
-
- dump ("lastPrivacyView is " + parent.lastPrivacyView + "\n");
- }
-
- // onload handler for privacy panel. grab the privacy mode enums, and register
- // AssertChanges with prefwindow so we get called on OK presses.
-
- AdminCallback = new Object();
- AdminCallback.OnRequestInfoComplete = function(type,info)
- {
- dump("On RequestInfoComplete\n");
-
- switch (type) {
- case Components.interfaces.nsIAimAdminInfo.RegistrationStatusPreference:
- dump("info is " + info + "\n");
- parent.lastPrivacyView = info;
-
- dump("Got the aim privacy view\n");
- lastViewRadio = viewToRadio(parent.lastPrivacyView);
-
- if ( lastViewRadio != undefined && lastViewRadio != null) {
- var privacyViewElement = document.getElementById("privacyView");
- privacyViewElement.selectedItem = lastViewRadio;
- }
- break;
- default:
- break;
- }
- }
- AdminCallback.OnRequestInfoError = function(pErrMsg)
- {
- dump("OnRequestInfoError\n");
- }
-
- adminGetterCallback = new Object();
-
- adminGetterCallback.ExecuteIfReady = function()
- {
- dump("about to get the disclosure level\n");
- aimAdminManager().RequestInfoRegistrationStatusPreference(AdminCallback);
- }
-
- function DisablePrivacyUI()
- {
- var el = document.getElementById("aim_privacy_contact_allowallusers");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("aim_privacy_contact_allowbuddylistusers");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("aim_privacy_contact_allowonlylist");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("aim_privacy_contact_blockallusers");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("aim_privacy_contact_blocklistusers");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("button1");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("button2");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("button3");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("button4");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("chatInvites");
- if ( el )
- el.setAttribute( "disabled", "true" );
- /* el = document.getElementById("idleTime");
- if ( el )
- el.setAttribute( "disabled", "true" );
- */
- el = document.getElementById("privacyView");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("fulldisclosure");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("limiteddisclosure");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("nodisclosure");
- if ( el )
- el.setAttribute( "disabled", "true" );
- }
-
- function DiscardPrivacyChanges()
- {
-
- var IMServiceClass = Components.classes['@netscape.com/aim/IMManager;1'];
- var pIIMManager = IMServiceClass.getService(Components.interfaces.nsIIMManager);
- var pIAimString = pIIMManager.QueryInterface(Components.interfaces.nsIStringBundle);
-
- if ( pIAimString == undefined || pIAimString == null )
- return;
-
- var str = pIAimString.GetStringFromName( "privacy.exitmsg" );
- if (str == undefined || str ==null)
- return;
-
- alert( str );
- }
-
- function IsSignedOn()
- {
- var state = aimSession().CurrentState;
- dump( "state is " + state + " \n" );
-
- if ( state == stateEnums.Online || state == stateEnums.OnlineAway )
- return true;
- return false;
- }
-
- function PrefIMPrivacyOnLoad()
- {
- dump("PrefIMPrivacyOnLoad\n");
- if ( (false == IsSignedOn()) || (isIcq() == true) ) {
- var str = getString( "privacy.entermsg" );
- DisablePrivacyUI();
- alert( str );
- parent.hPrefWindow.registerOKCallbackFunc( DiscardPrivacyChanges );
- }
- else {
- parent.hPrefWindow.registerOKCallbackFunc( AssertPrivacyChanges );
-
-
- //var sessionType=aimSession.getSessionType();
- var sessionType =aimPrefsManager().GetIntPref("aim.session.sessiontype", null, false);
- if( sessionType == 0) {
- var tree = document.getElementById("Allow");
- tree.database.AddDataSource(aimRDF().GetDataSource("rdf:AIM"));
- tree.setAttribute('ref', tree.getAttribute('ref'));
- var tree = document.getElementById("Deny");
- tree.database.AddDataSource(aimRDF().GetDataSource("rdf:AIM"));
- tree.setAttribute('ref', tree.getAttribute('ref'));
- }
- }
- var priv = aimPrivacy();
- // do it only the first time!
- if (parent.lastPrivacyMode == undefined)
- parent.lastPrivacyMode = priv.PrivacyMode;
-
- dump("Got the aim privacy mode\n");
- lastRadio = modeToRadio(parent.lastPrivacyMode);
-
- if ( lastRadio != undefined && lastRadio != null)
- lastRadio.setAttribute("selected","true");
-
- if ( parent.lastChatInvites != undefined && parent.lastChatInvites != null) {
- var checkbox = document.getElementById("chatInvites");
- if ( checkbox != undefined && checkbox != null ) {
- checkbox.setAttribute("selected",parent.lastChatInvites);
- }
- }
-
- dump("set the radio.selected property\n");
- //aimPreferenceOnload();
- //dump("did the per screen name munging\n");
-
- var loggedin = true;
-
- if (loggedin && (parent.lastPrivacyView == undefined))
- {
- aimAdminManager().ExecuteIfReady(adminGetterCallback);
- }
- var feedbag = aimFeedbagManager();
- var prefmask = feedbag.GetBuddyPrefs();
- if (prefmask & Components.interfaces.nsAimBuddyPrefs.DiscloseIdleTime)
- {
- document.getElementById("idle").checked = true;
- parent.lastIdle = true;
- }
- else
- {
- parent.lastIdle = false;
- }
- updateListBoxSelection("Allow");
- updateListBoxSelection("Deny");
- }
-
- function PrefIMPrivacyOnUnload()
- {
- // nothing for now
- }
-
- // grab a screenname from the user.
-
- function PostGetUserDlg( which )
- {
- openDialog("chrome://aim/content/pref-IM_getuser.xul", "",
- "modal=yes,chrome", which);
- }
-
- // delete the screenname entered by the user from the allow or deny list.
- // "which" indicates which list to purge from
-
- function DeleteFromList( which )
- {
- var listbox = document.getElementById(which);
- var pIAimPrivacy = aimPrivacy();
- var selectedUser;
-
-
- for (var i = 0; i <= listbox.selectedItems.length; i++) {
- selectedUser = listbox.selectedItems[i].getAttribute("label");
- if ( which == "Allow" ) {
- pIAimPrivacy.AllowListRemove( selectedUser );
- }
- else if ( which == "Deny" ) {
- pIAimPrivacy.DenyListRemove( selectedUser );
- }
- updateListBoxSelection(which);
- break;
- }
- }
-
- // onload handler for the dialog used to get a screenname from the user
-
- function GetUserOnLoad()
- {
- doSetOKCancel(GetUserAdd, 0);
- top.addMode = window.arguments[0];
- document.getElementById("fldUserName").focus();
- }
-
- // called when OK button is pressed in privacy mode preferences panel. Figure
- // out what changed, communicate this to AIM Glue backend
-
- function AssertPrivacyChanges()
- {
- // We cannot use global variables as this is called in the
- // context of the Parent window much later!!
- dump("Calling function prefIM.js AssertChanges\n");
- var IMServiceClass = Components.classes['@netscape.com/aim/IMManager;1'];
- var pIIMManager = IMServiceClass.getService(Components.interfaces.nsIIMManager)
- var lastRadio = null;
- var allEnums = Components.interfaces.nsAimPrivacyModes;
- var pIAimPrivacy = pIIMManager.QueryInterface(Components.interfaces.nsIAimPrivacy)
-
- if ( pIAimPrivacy == undefined || pIAimPrivacy == null )
- return;
-
- // This has been simplified and made correct
- pIAimPrivacy.PrivacyMode = parent.lastPrivacyMode;
- var tvalues = false;
-
- dump ("saved privacy mode in AIM as " + parent.lastPrivacyMode + "\n");
-
- var pAimAdmin = pIIMManager.QueryInterface(Components.interfaces.nsIAimAdminManager);
-
- if ( pAimAdmin == undefined || pAimAdmin == null )
- return;
-
- adminSetterCallback = new Object();
- adminSetterCallback.ExecuteIfReady = function()
- {
- dump("adminsettercallback executeifready\n");
-
- // this kinda code is dangerous -- should not glom so many
- // things that can fail into one statement XXX
-
- Components.classes['@netscape.com/aim/IMManager;1'].getService(Components.interfaces.nsIIMManager).QueryInterface(Components.interfaces.nsIAimAdminManager).ChangeRegistrationStatusPreference(null,parent.lastPrivacyView);
- }
-
- dump("adminsettercallback.execifready\n");
- pAimAdmin.ExecuteIfReady(adminSetterCallback);
-
- var pAimPrefs = pIIMManager.QueryInterface(Components.interfaces.nsIPrefsManager);
-
- dump( "parent.lastChatInvites is " + parent.lastChatInvites + " \n" );
- if ( parent.lastChatInvites != undefined ) {
- pAimPrefs.SetBoolPref("aim.chat.unavailable", parent.lastChatInvites, null, false);
- }
-
- var chatInvite_pref=false;
- try {
- chatInvite_pref= pAimPrefs.GetBoolPref("aim.chat.unavailable", null, false);
- }
- catch (ex) {
- dump("chat announce pref could not be read\n");
- chatInvite_pref = false;
- }
- pChatManager= pIIMManager.QueryInterface(Components.interfaces.nsIAimChatManager);
- // Suresh: Setting it to complement coz the pref is aim.chat._un_available. Gee...This is confusing..heh.
- pChatManager.SetAvailableForChat(!chatInvite_pref);
- dump("Setting chat invite to "+chatInvite_pref+"\n");
-
- try {
- var feedbag = aimFeedbagManager();
- prefmask = feedbag.GetBuddyPrefs();
- // if the idle pref is true and the user just cleared it
- var idlemask = Components.interfaces.nsAimBuddyPrefs.DiscloseIdleTime;
- if(!parent.lastIdle && (prefmask & idlemask))
- {
- prefmask -= idlemask;
- var myaimSession = aimSession();
- aimSession().AimIdleStop();
- }
- // if the idle pref is false and it was false to begin with
- else if(!parent.lastIdle && !(prefmask & idlemask))
- {
- return;
- }
- //if the idle pref was true and it is still true
- else if (prefmask & idlemask)
- {
- return;
- }
- //if the idle pref was false and the just turned it on.
- else
- {
- prefmask += idlemask;
- }
- feedbag.SetBuddyPrefs(prefmask);
- }
-
- catch (ex) {}
- return;
-
- }
-
-
- function
- FindAwayMessageTargetByName( msgName )
- {
- GetRDFService();
-
- var messages_file = GetRdfFileUrl("default-messages.rdf", "dm.rdf");
- var datasource = RDF.GetDataSource(messages_file);
-
- var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance();
- container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
- container.Init(datasource, RDF.GetResource("NC:AIM/AwayMessageBag"));
-
- var elements = container.GetElements();
- var target, node;
- var nameResource =
- RDF.GetResource("http://home.netscape.com/NC-rdf#MsgName");
- while ( elements.hasMoreElements() ) {
- node = elements.getNext();
- if ( node )
- target = datasource.GetTarget( node, nameResource,
- true );
- if ( target )
- target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
- if ( target && target.Value == msgName )
- return target.Value;
- }
- return null;
- }
-
- function
- EditAwayMessageOnOK()
- {
- var nameItem = document.getElementById("awayMessageName");
- var textItem = document.getElementById("awayMessageText");
- var nameValue = null;
- var textValue = null;
-
- if ( !nameItem || nameItem == undefined )
- return;
- if ( !textItem || textItem == undefined )
- return;
- nameValue = nameItem.value;
- textValue = textItem.value;
- if ( nameValue == "" ) {
- alert(getString("away.EnterLabel"));
- return;
- }
- if ( textValue == "" ) {
- alert(getString("away.EnterMessage"));
- return;
- }
-
- var target = FindAwayMessageTargetByName( nameValue );
- if ( target == null ) {
- retval = confirm(getString("away.DoesNotExist"));
- if ( retval == true )
- AssertAwayMessage( nameValue, textValue );
- else
- return;
- } else
- SetAwayMessageTarget( nameValue, textValue )
- top.window.close();
- }
-
- function
- AddAwayMessageOnOK()
- {
- var nameItem = document.getElementById("awayMessageName");
- var textItem = document.getElementById("awayMessageText");
- var nameValue = null;
- var textValue = null;
-
- if ( !nameItem || nameItem == undefined )
- return;
- if ( !textItem || textItem == undefined )
- return;
- nameValue = nameItem.value;
- textValue = textItem.value;
- if ( nameValue == "" ) {
- alert(getString("away.EnterLabel"));
- return;
- }
- if ( textValue == "" ) {
- alert(getString("away.EnterMessage"));
- return;
- }
-
- if ( FindAwayMessageTargetByName( nameValue ) != null ) {
-
- // ask them if they would like to overwrite (i.e.,
- // turn this into an edit).
-
- var response = confirm(getString("away.AlreadyExists"));
- if ( response == true ) {
- EditAwayMessageOnOK();
- return;
- } else {
- alert(getString("away.EnterLabel"));
- return;
- }
- }
-
- AssertAwayMessage( nameValue, textValue );
- top.window.close();
- }
-
- function
- AssertAwayMessage( nameValue, textValue )
- {
- GetRDFService();
-
- var newmsg = RDF.GetAnonymousResource();
- var messages_file = GetRdfFileUrl("default-messages.rdf", "dm.rdf");
-
- var datasource =
- RDF.GetDataSource(messages_file);
- datasource.Assert(newmsg,
- RDF.GetResource("http://home.netscape.com/NC-rdf#MsgName"),
- RDF.GetLiteral(nameValue), true);
- datasource.Assert(newmsg,
- RDF.GetResource("http://home.netscape.com/NC-rdf#MsgText"),
- RDF.GetLiteral(textValue), true);
-
- var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance();
- container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
- container.Init(datasource, RDF.GetResource("NC:AIM/AwayMessageBag"));
-
- container.AppendElement(newmsg);
- datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
- }
-
- function
- AddAwayMessage()
- {
- // title is window.arguments[1];
- // content is window.arguments[2];
-
- window.openDialog("chrome://aim/content/AddAwayMessage.xul","_blank", "chrome,close,titlebar,modal", "", "", "");
- }
-
- function
- EditAwayMessage()
- {
- // title is window.arguments[1];
- // content is window.arguments[2];
-
- var msgName, msgText;
- var response;
-
- response = FindSelectedAwayMessage();
- if ( response == null ) {
- alert(getString("away.PleaseSelectToEdit"));
- return;
- } else {
- msgName = response.msgName;
- msgText = response.msgText;
- }
-
- window.openDialog("chrome://aim/content/AddAwayMessage.xul","_blank", "chrome,close,titlebar, modal", "", msgName, msgText);
- }
-
- function
- RemoveAwayMessage()
- {
- var msgName, msgText;
- var response;
-
- response = FindSelectedAwayMessage();
- if ( response == null ) {
- alert(getString("away.PleaseSelectToRemove"));
- return;
- }
-
- answer = confirm(getString("away.AreYouSure").replace(/%AwayMsg%/,response.msgName));
- if ( answer == true )
- RemoveTarget( response.msgName );
- }
-
- function
- FindSelectedAwayMessage()
- {
- var selection;
- var tree = document.getElementById("AwayMessages");
-
- var response = new Object();
-
- if ( tree )
- selection = tree.contentView.getItemAtIndex(tree.currentIndex);
-
- if ( selection) {
- response.msgName = selection.getAttribute("MsgName");
- response.msgText = selection.getAttribute("MsgText");
-
- return response;
- }
- return null;
- }
-
-
- //XXXVISHY - per screen name stuff
-
- function getCurrentScreenName()
- {
- var myaimSession = aimSession();
- if (myaimSession) {
- return myaimSession.CurrentScreenName;
- }
- else
- return "";
- }
-
- // XXXVISHY - the aimPreferenceOnload function MUST be called in the
- // onload handler of every aim preference panel so as to do the
- // per screen name munging
-
- /* every element has: prefstring, preftype, preattribute, pref (true/false), prefscope(0,1,2)
-
- preftype, a type of value to retrieve;
- preattribute, a type of element attribute to assign
-
-
- preftype = true, if it is for preference element only
- prefscope = 0, PER_SN,
- prefscope = 2, SESSION_GLOBAL,
- prefscope = 1, GEN_GLOBAL
-
- */
-
- function aimPreferenceOnload()
- {
- dump("starting aimPreferenceOnload\n");
- var aimprefs = document.getElementsByAttribute("pref", "true");
- var sN;
- var qPreference;
- var curDefPref;
- var panelType = 0;
-
- for (var i = 0 ; i < aimprefs.length ; i++) {
- var preference = aimprefs[i].getAttribute("prefstring");
- var curprefScope = aimprefs[i].getAttribute("prefscope");
- dump("curprefScope=" + curprefScope + "\n");
- if (curprefScope == 2 || curprefScope == 1) {
-
- if (panelType == 0)
- qPreference = preference + ".aim";
- else //panelType == 2
- qPreference = preference + ".icq";
-
- }
- else { // scope == 0, PER_SN
-
- if (panelType == aimPrefsManager().GetSessionType())
- {
- sN = getCurrentScreenName() + ".";
- qPreference = sN + preference;
-
- if (MozPreferences.getPrefType(qPreference) == Components.interfaces.nsIPrefBranch.PREF_INVALID)
- {
- // first time with this pref, so create a per screen name copy
- if (MozPreferences.getPrefType(preference) == Components.interfaces.nsIPrefBranch.PREF_INVALID)
- {
- // "preference" is not default name, create default name
-
- if (panelType == 0)
- curDefPref = preference + ".aim";
- else //panelType == 2
- curDefPref = preference + ".icq";
- }
- else {
- curDefPref = preference;
- }
- dump("curDefPref=" + curDefPref + "\n");
-
- switch (MozPreferences.getPrefType(curDefPref)) {
- case Components.interfaces.nsIPrefBranch.PREF_STRING:
- var sPref = MozPreferences.getCharPref(curDefPref);
- MozPreferences.setCharPref(qPreference, sPref);
- break;
- case Components.interfaces.nsIPrefBranch.PREF_INT:
- var iPref = MozPreferences.getIntPref(curDefPref);
- MozPreferences.setIntPref(qPreference, iPref);
- break;
- case Components.interfaces.nsIPrefBranch.PREF_BOOL:
- var bPref = MozPreferences.getBoolPref(curDefPref);
- MozPreferences.setBoolPref(qPreference, bPref);
- break;
- default:
- dump("Bad pref type for NIM\n");
- break;
- }
-
-
- }
- }
- else
- {
- qPreference = "__sys." + preference;
-
- }
-
-
- }
-
- aimprefs[i].setAttribute("prefstring", qPreference);
-
- }
-
- }
-
-
-
- /*
- XXXVISHY - this is a hack. The aimPreferenceOnload would have munged
- aim.mail.presence into a per-screen name pref. This function
- will unmunge it back into a global preference. This is done in this
- ugly manner since it is the least invasive way at this point.
- */
-
- function aimMailPresenceUnMunge()
- {
- var mailPref = document.getElementById("mailPresence");
- mailPref.setAttribute("prefstring", "aim.mail.presence");
- }
-
-
-
- /************* Related to the Connection/Proxy Panel ********************/
-
-
-
-
-
- /*Below all new function for connection panel*/
- /*Below all new function for connection panel*/
- /*Below all new function for connection panel*/
- /*Below all new function for connection panel*/
-
- //OnLoad AddConnection
- function EditConnectionOnLoad()
- {
- // window.arguments[1] is type of ops for title,
- // window.arguments[2] is connection name
-
-
- var panelTtl = document.getElementById("panelTitle");
-
- var connectName = document.getElementById("connectName");
-
- dump("arg1=" + window.arguments[1] + "\narg2=" + window.arguments[2] + "\n");
- if (window.arguments[1] == "Add") {
- panelTtl.setAttribute('title' , panelTtl.getAttribute('titl1'));
-
-
- doSetOKCancel(AddConnMessageOnOK, 0);
-
- connLinks.ConnectionName = "";
- connLinks.SessionType = 0;
- connLinks.Host = "";
- connLinks.Port = "";
- connLinks.ProxyHost = "";
- connLinks.ProxyPort = 1080;
- connLinks.ProxyUser = "";
- connLinks.ProxyPassword = "";
- connLinks.ProxyProtocol = 0;
- connLinks.IsProxy = false;
- connLinks.ConnectionType = 0;
-
- }
- else { /* Edit mode */
- panelTtl.setAttribute('title' , panelTtl.getAttribute('titl2'));
-
-
- doSetOKCancel(EditConnMessageOnOK, 0);
-
- var curConnName = window.arguments[2];
-
- setValuesFromRDF (curConnName);
-
- }
-
- setConnUI();
-
- DoFullEnabling();
-
- }
-
- function setValuesFromRDF (connectionName)
- {
- dump("starting setValuesFromRDF\n");
- GetRDFService();
-
- var messages_file = CopynGetUrl("default-connections.rdf", "connections.rdf");
- var datasource = RDF.GetDataSource(messages_file);
-
- var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance();
- container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
- container.Init(datasource, RDF.GetResource("NC:AIM/ConnectionsSeq"));
-
- var ConnNameLiteral = RDF.GetLiteral(connectionName);
-
- var ConnName = RDF.GetResource("http://home.netscape.com/NC-rdf#ConnectionName");
-
- var node = datasource.GetSource (ConnName, ConnNameLiteral, true);
-
- if (node)
- {
- var curName;
- for (var linkName in connLinks)
- {
- curName = datasource.GetTarget (node,
- RDF.GetResource("http://home.netscape.com/NC-rdf#" + linkName),
- true);
- if ( curName ) {
- curName = curName.QueryInterface(Components.interfaces.nsIRDFLiteral);
- connLinks[linkName] = curName.Value;
- }
- }
- }
-
- }
-
- function DoFullEnabling() {
-
- var connectName = document.getElementById("connectName");
- var aimHost = document.getElementById("aimHost");
- var aimPort = document.getElementById("aimPort");
-
- var Name = connectName.value;
-
- if (Name == "AIM" || Name == "AOL" || Name == "ICQ") {
- connectName.setAttribute( "disabled", "true" );
- aimHost.setAttribute( "disabled", "true" );
- }
- else {
- if (window.arguments[1] == "Add") {
- connectName.setAttribute( "disabled", "false" );
- connectName.removeAttribute( "disabled" );
- }
- else { // Edit
- connectName.setAttribute( "disabled", "true" );
- }
-
- aimHost.setAttribute( "disabled", "false" );
- aimHost.removeAttribute( "disabled" );
-
- }
-
- // enable proxy protocol fields
- DoEnabling();
- }
-
- //OnLoad pref-IM_connection.xul
- function PrefIMConnectionOnLoad(){
- // init datasource
- dump("starting PrefIMConnectionOnLoad\n");
-
- GetRDFService();
-
- // copy file to profile and return full URL of the file
- var connection_file = CopynGetUrl("default-connections.rdf", "connections.rdf");
-
- if (!connection_file)
- return;
-
- datasource = RDF.GetDataSource(connection_file);
-
- dump( "datasource " + datasource + "\n" );
-
- var tree = document.getElementById("ConnectionList");
- tree.database.AddDataSource(datasource);
- tree.setAttribute('ref', tree.getAttribute('ref'));
-
- // disable 2 buttons, no selection here
- document.getElementById("btnEdit").setAttribute("disabled", true);
- document.getElementById("btnRemove").setAttribute("disabled", true);
- }
-
-
- function FindSelectedConnection(connInfo)
- {
- var selection;
- var list = document.getElementById("ConnectionList");
- dump("starting FindSelectedConnection\n");
-
-
- if ( list && list.selectedItem ) {
- connInfo.name = list.selectedItem.getAttribute("ConnectionName");
- connInfo.sessiontype = list.selectedItem.getAttribute("sessionType");
- dump("connInfo.name=" + connInfo.name + " connInfo.sessiontype=" + connInfo.sessiontype + "\n");
- return connInfo;
-
- }
- return null;
- }
-
-
- // 3 buttons
- function AddConnMessage()
- {
- dump("starting AddConnMessage\n");
-
- window.openDialog("chrome://aim/content/pref-IM_addconnection.xul","_blank", "chrome,close,titlebar,modal", "", "Add", "");
-
- }
-
- function EditConnMessage()
- {
- dump("starting EditConnMessage\n");
-
- var ConnectionInfo = new Object();
- ConnectionInfo.name ="";
- ConnectionInfo.sessiontype = "";
-
-
- FindSelectedConnection(ConnectionInfo);
- var ConnectionName = ConnectionInfo.name;
-
- dump("ConnectionName=" + ConnectionName + "\n");
- if ( ConnectionName == null ) {
- alert(getString("connection.PleaseSelectToEdit"));
- return;
- }
-
- window.openDialog("chrome://aim/content/pref-IM_addconnection.xul","_blank", "chrome,close,titlebar, modal", "", "Edit", ConnectionName);
-
- }
-
- function RemoveConnMessage()
- {
- dump("starting RemoveConnMessage\n");
-
- var ConnectionInfo = new Object();
- ConnectionInfo.name ="";
- ConnectionInfo.sessiontype = "";
-
-
- FindSelectedConnection(ConnectionInfo);
- var ConnectionName = ConnectionInfo.name;
-
- if ( ConnectionName == null ) {
- alert(getString("connection.PleaseSelectToRemove"));
- return;
- }
-
- var answer = confirm(getString("connection.AreYouSure").replace(/%AwayMsg%/, ConnectionName));
-
- if ( answer == true )
- RemoveConnectionfromDatasrc( ConnectionName );
-
-
- }
-
-
- function RemoveConnectionfromDatasrc( ConnectionName )
- {
- GetRDFService();
-
- var messages_file = CopynGetUrl("default-connections.rdf", "connections.rdf");
- var datasource = RDF.GetDataSource(messages_file);
-
- var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance();
- container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
- container.Init(datasource, RDF.GetResource("NC:AIM/ConnectionsSeq"));
-
- var ConnNameLiteral = RDF.GetLiteral(ConnectionName);
-
- var ConnName = RDF.GetResource("http://home.netscape.com/NC-rdf#ConnectionName");
-
- var node = datasource.GetSource (ConnName, ConnNameLiteral, true);
-
- if (node) {
- // remove from container
- container.RemoveElement( node, true );
-
- // remove connection info
- var curProp;
- var curTarget;
- for (var curName in connLinks)
- {
- curProp = RDF.GetResource("http://home.netscape.com/NC-rdf#" + curName);
- curTarget = datasource.GetTarget(node, curProp, true);
-
- datasource.Unassert (node, curProp, curTarget );
- }
-
- datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
- }
-
- return null;
-
- }
-
-
- //2 callbacks for AddConnection editing window
- function AddConnMessageOnOK()
- {
- dump("starting AddConnMessageOnOK\n");
- GetRDFService();
-
- var messages_file = CopynGetUrl("default-connections.rdf", "connections.rdf");
- var datasource = RDF.GetDataSource(messages_file);
-
- var connectName = document.getElementById("connectName");
- var connectNameVal = connectName.value;
-
- dump("connectNameVal=" + connectNameVal + "\n");
- if (connectNameVal == "")
- {
- alert(getString("connection.EnterName"));
- return;
- }
-
- var node = datasource.GetSource (RDF.GetResource("http://home.netscape.com/NC-rdf#ConnectionName"),
- RDF.GetLiteral(connectNameVal),
- true);
-
- if (node) {
- alert(getString("connection.AlreadyExists"));
- return;
- }
-
-
- getConnInfoFromUI();
-
- AddConnectionDatasource ();
- top.window.close();
- }
-
- function EditConnMessageOnOK()
- {
- GetRDFService();
-
- var messages_file = CopynGetUrl("default-connections.rdf", "connections.rdf");
- var datasource = RDF.GetDataSource(messages_file);
-
- var connectNameVal = document.getElementById("connectName").value;
-
- var node = datasource.GetSource (RDF.GetResource("http://home.netscape.com/NC-rdf#ConnectionName"),
- RDF.GetLiteral(connectNameVal),
- true);
-
- if (!node)
- return;
-
- getConnInfoFromUI();
-
- EditConnectionDatasource(node);
- top.window.close();
- }
-
- function setConnUI()
- {
-
- var panelSessionType = 0;
-
- var connectName = document.getElementById("connectName");
- var aimHost = document.getElementById("aimHost");
- var aimPort = document.getElementById("aimPort");
- var proxyHost = document.getElementById("proxyHost");
- var proxyPort = document.getElementById("proxyPort");
- var proxyUserName = document.getElementById("proxyUserName");
- var proxyPassword = document.getElementById("proxyPassword");
- var proxyUse = document.getElementById("proxyUse");
- var proxyProtocol = document.getElementById("proxyProtocol");
-
- if (panelSessionType != 2)
- var IsAol = document.getElementById("IsAol");
-
- connectName.value = connLinks.ConnectionName;
-
- aimHost.value = connLinks.Host;
- aimPort.value = connLinks.Port;
- proxyHost.value = connLinks.ProxyHost;
- proxyPort.value = connLinks.ProxyPort;
- proxyUserName.value = connLinks.ProxyUser;
-
- var pIAimSession = aimSession();
- if ( pIAimSession ) {
- proxyPassword.value = pIAimSession.UnMungeString(connLinks.ProxyPassword);
- dump("UnMungeString connLinks.ProxyPassword=" + connLinks.ProxyPassword + " proxyPassword.value=" + proxyPassword.value + "\n");
- }
-
-
- if (connLinks.ProxyProtocol > 0 && connLinks.ProxyProtocol <= 4)
- proxyProtocol.selectedItem = proxyProtocol.childNodes[connLinks.ProxyProtocol - 1];
- else
- proxyProtocol.selectedItem = proxyProtocol.childNodes[0];
-
-
- if (connLinks.IsProxy == "true")
- proxyUse.setAttribute ("checked", true);
- else
- proxyUse.setAttribute ("checked", false);
-
- /* proxyUse.checked= connLinks.IsProxy;*/
-
- dump("proxyUse.checked=" + proxyUse.checked + " connLinks.IsProxy=" + connLinks.IsProxy + "\n");
-
- if (panelSessionType != 2) {
- if (connLinks.ConnectionType == 1)
- proxyUse.setAttribute ("checked", true);
- else
- proxyUse.setAttribute ("checked", false);
-
- }
-
- }
-
- // Remove whitespace from both ends of a string
- function TrimString(string)
- {
- if (!string) return "";
- return string.replace(/(^\s+)|(\s+$)/g, '')
- }
-
- function getConnInfoFromUI()
- {
- dump("starting getConnInfoFromUI\n");
- var panelSessionType = 0;
-
- var connectName = document.getElementById("connectName");
- var aimHost = document.getElementById("aimHost");
- var aimPort = document.getElementById("aimPort");
- var proxyHost = document.getElementById("proxyHost");
- var proxyPort = document.getElementById("proxyPort");
- var proxyUserName = document.getElementById("proxyUserName");
- var proxyPassword = document.getElementById("proxyPassword");
- var proxyUse = document.getElementById("proxyUse");
- var proxyProtocol = document.getElementById("proxyProtocol");
- var IsAol = document.getElementById("IsAol");
-
- connLinks.ConnectionName = TrimString(connectName.value);
- connLinks.SessionType = panelSessionType;
- dump("connLinks.SessionType=" + connLinks.SessionType + "\n");
- connLinks.Host = TrimString(aimHost.value);
- connLinks.Port = TrimString(aimPort.value);
- connLinks.ProxyHost = TrimString(proxyHost.value);
- connLinks.ProxyPort = TrimString(proxyPort.value);
- connLinks.ProxyUser = TrimString(proxyUserName.value);
-
- var pIAimSession = aimSession();
- if(pIAimSession) {
- // trim?
- connLinks.ProxyPassword = pIAimSession.MungeString(proxyPassword.value);
- dump("MungeString proxyPassword.value=" + proxyPassword.value + " connLinks.ProxyPassword=" + connLinks.ProxyPassword + "\n");
-
- }
-
- // trim?
-
- connLinks.ProxyProtocol = proxyProtocol.selectedItem.getAttribute("value");
- connLinks.IsProxy = proxyUse.checked;
-
-
- dump("isaolchecked=" + IsAol.checked + "\n");
- if (panelSessionType != 2) {
- if (IsAol.checked)
- connLinks.ConnectionType = 1;
- else
- connLinks.ConnectionType = 0;
-
- }
- else
- connLinks.ConnectionType = 2;
- }
-
- function AddConnectionDatasource()
- {
- GetRDFService();
-
- var messages_file = CopynGetUrl("default-connections.rdf", "connections.rdf");
- var datasource = RDF.GetDataSource(messages_file);
-
- var newConn = RDF.GetAnonymousResource();
-
- for (var curName in connLinks)
- {
- datasource.Assert(newConn, RDF.GetResource("http://home.netscape.com/NC-rdf#" + curName),
- RDF.GetLiteral(connLinks[curName]), true);
- }
-
- var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance();
- container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
- container.Init(datasource, RDF.GetResource("NC:AIM/ConnectionsSeq"));
-
- container.AppendElement(newConn);
- datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
-
- }
-
-
- function EditConnectionDatasource( connectionNode )
- {
- GetRDFService();
-
- var messages_file = CopynGetUrl("default-connections.rdf", "connections.rdf");
- var datasource = RDF.GetDataSource(messages_file);
-
- var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance();
- container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
- container.Init(datasource, RDF.GetResource("NC:AIM/ConnectionsSeq"));
-
- var curLinkRes;
- var oldTarget;
- for(var curName in connLinks)
- {
- if (curName != "ConnectionName") {// ConnectionName was set already
- curLinkRes = RDF.GetResource("http://home.netscape.com/NC-rdf#" + curName);
- oldTarget = datasource.GetTarget(connectionNode, curLinkRes, true);
-
- datasource.Change( connectionNode, curLinkRes,
- oldTarget, RDF.GetLiteral(connLinks[curName]) );
- }
- }
-
-
- datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
-
- }
- /* keep for the future UI
- function SetExternalConnection()
- {
- var ConnectionInfo = new Object();
- ConnectionInfo.name ="";
- ConnectionInfo.sessiontype = "";
-
-
- FindSelectedConnection(ConnectionInfo);
- var ConnectionName = ConnectionInfo.name;
-
- document.getElementById("mailConn").value = ConnectionName;
- setConnectionInfo (ConnectionName, "mail");
-
- }
- */
-
- function SetHostPortDefault(type)
- {
-
- dump("type=" + type + "\n");
- var host = document.getElementById("aimHost");
- var port = document.getElementById("aimPort");
-
- var aol = document.getElementById("IsAol").checked;
-
- if (aol) {
- host.setAttribute("value", "americaonline.aol.com");
- port.setAttribute("value", "5200");
- }
- else {
- host.setAttribute("value", "login.oscar.aol.com");
- port.setAttribute("value", "5190");
- }
-
-
-
- }
-
- function EnableConnButtons()
- {
- var connInfo = new Object();
- connInfo.name ="";
- connInfo.sessiontype = "";
-
-
- FindSelectedConnection(connInfo);
- var ConnectionName = connInfo.name;
-
- var panelSessionType = 0;
- dump("connInfo.name =" + connInfo.name + " connInfo.sessiontype=" + connInfo.sessiontype +
- "panelSessionType=" + panelSessionType + "\n");
-
- if(connInfo.sessiontype == panelSessionType) {
- document.getElementById("btnEdit").setAttribute("disabled", false);
- document.getElementById("btnEdit").removeAttribute( "disabled" );
-
- }
- else {
- document.getElementById("btnEdit").setAttribute("disabled", true);
- }
-
-
- if (connInfo.name == "AIM" || connInfo.name == "AOL" || connInfo.name == "ICQ" ||
- (connInfo.sessiontype != panelSessionType)) {
-
- document.getElementById("btnRemove").setAttribute("disabled", true);
-
- }
- else {
- document.getElementById("btnRemove").setAttribute("disabled", false);
- document.getElementById("btnRemove").removeAttribute( "disabled" );
- }
-
-
- }
-
-
- // new update
-
- function PrefIMConnectionOnload()
- {
- var proxPass = "";
- DoEnabling();
- parent.ConnectionLoad = 1;
- parent.connectionSaved = 0;
- if ( parent.ConnectionCallback == undefined ||
- parent.ConnectionCallback == null ) {
-
- // Register the OK callback func once, and unmunge the initial value
-
- parent.ConnectionCallback = 1;
- parent.hPrefWindow.registerOKCallbackFunc( AssertProxyChanges );
- var pIAimSession = aimSession();
- if ( pIAimSession ) {
- proxPass = pIAimSession.UnMungeString(document.getElementById("proxyPassword").value);
- parent.proxyPassword = proxPass;
- }
- } else {
-
- // we switched back from some other panel, so restore the
- // saved off value from the unload handler
-
- proxPass = parent.proxyPassword;
- }
- document.getElementById("proxyPassword").value = proxPass;
- }
-
- function
- AssertProxyChanges()
- {
- // if the connection panel is loaded, base64 the current password
-
- if ( parent.ConnectionLoad == 1 )
- MungeProxyPassword();
-
- // set this so the unload handler doesn't do anything when called
-
- parent.connectionSaved = 1;
- }
-
- function PrefIMConnectionOnunload()
- {
- // we already saved (e.g., here because OK was hit), so juswt return
-
- if ( parent.connectionSaved == 1 )
- return;
-
- // ok, switching to some other panel. Save off the current value
- // to be restored in the onload handler, and remember we are not
- // visible so we deal with the AssertProxyChanges() callback in
- // the correct manner
-
- parent.proxyPassword = document.getElementById("proxyPassword").value;
- MungeProxyPassword(); // just in case OK is hit while away
- parent.ConnectionLoad = 0;
- }
-
- function DoEnabling()
- {
- var host = document.getElementById("proxyHost");
- var port = document.getElementById("proxyPort");
- var protocol = document.getElementById("proxyProtocol");
- var userName = document.getElementById("proxyUserName");
- var password = document.getElementById("proxyPassword");
- var radiogroup0 = document.getElementById("proxyProtocolSocks4");
- var radiogroup1 = document.getElementById("proxyProtocolSocks5");
- var radiogroup2 = document.getElementById("proxyProtocolHttps");
- var radiogroup3 = document.getElementById("proxyProtocolHttp");
-
- // convenience arrays
- var manual = [host, port, protocol, userName, password, radiogroup0, radiogroup1, radiogroup2, radiogroup3];
-
- // checkbox button
- var checkboxitem = document.getElementById("proxyUse");
- if ( checkboxitem.checked ) {
- for( var i = 0; i < manual.length; i++ ) {
- manual[i].setAttribute( "disabled", "false" );
- manual[i].removeAttribute( "disabled" );
- }
- } else {
- for( var i = 0; i < manual.length; i++ )
- manual[i].setAttribute( "disabled", "true" );
- }
- }
-
-
- function MungeProxyPassword()
- {
- //XXXVISHY - you cannot use macros like AimSessionObject in
- // any callback because the javascript context will not remember
- // the included files!!!
-
- var IMServiceClass = Components.classes['@netscape.com/aim/IMManager;1'];
- var pIIMManager = IMServiceClass.getService(Components.interfaces.nsIIMManager)
- var pIAimSession = pIIMManager.QueryInterface(Components.interfaces.nsIAimSession)
- var proxPass = "";
- if(pIAimSession) {
- proxPass = pIAimSession.MungeString(document.getElementById("proxyPassword").value);
- document.getElementById("proxyPassword").value = proxPass;
- }
- }
-
-
- function resetConnection()
- {
- dump("IM reset\n");
- document.getElementById("aimHost").value = "login.oscar.aol.com"
- document.getElementById("aimPort").value = "5190";
- }
-
-
- /*connection panel end*/
-
-
- function UpdateAwayButtons()
- {
- var selection;
- var tree = document.getElementById("AwayMessages");
- if (tree)
- selection = tree.contentView.getItemAtIndex(tree.currentIndex);
- if ( selection ) {
- document.getElementById("buttonEditMess").setAttribute("disabled", "false");
- var parent = selection.parentNode;
- if (parent.childNodes.length != 1) {
- // If this is the last element in away tree, do not allow remove
- document.getElementById("buttonRemoveMess").setAttribute("disabled", "false");
- }
- }
- return;
- }
-
- function DisableButtons()
- {
- document.getElementById("buttonEditMess").setAttribute("disabled", "true");
- document.getElementById("buttonRemoveMess").setAttribute("disabled", "true");
- }
-
- function PrefIMBuddyIconOnLoad() {
- if( (false == IsSignedOn()) || (isIcq() == true) ) {
- var offlinetxt = aimString("bi.plsfirstsignon");
- var element = document.getElementById("OfflineIntro");
- var textNode = document.createTextNode(offlinetxt);
- element.appendChild(textNode);
- DisableBIElements();
- return;
- }
-
- var nimBuddy = aimBuddyManager();
- nimBuddy.InitBuddyIconsState();
-
- //select the first element *My Buddy Icon* on pref load.
- var buddyTree = document.getElementById("buddyIconTree");
- var treeselection = buddyTree.treeBoxObject.selection;
- treeselection.select(0);
-
-
- document.getElementById("OfflineIntro").setAttribute("hidden", "true");
- LoadPersonalBuddyIcon();
- }
-
- function buddyIconBrowse() {
- var buddyTree = document.getElementById("buddyIconTree");
- var startIndex = {};
- var endIndex = {};
- buddyTree.treeBoxObject.selection.getRangeAt(0, startIndex, endIndex);
- var sindex = startIndex.value;
- var eindex = endIndex.value;
- var view = buddyTree.treeBoxObject.view;
- var level = view.getLevel(sindex);
- var selectedItem = view.getCellText(sindex, "ListSetupCol");
-
- if ((level == 0) && (sindex > 0)) {
- //some group is selected....just return;
- return;
- }
-
- var ioService = GetIOService();
- var currentTime = new Date().getTime();
- var biimage = document.getElementById("buddyIconImage");
- var pIAimSession = pIIMManager.QueryInterface(Components.interfaces.nsIAimSession);
- var pDir = pIAimSession.profileDir;
-
- //set the image to current picture.gif
- var pictureDir = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
- pictureDir.initWithPath(pDir.path);
-
- //buddy picture directory.
- var bpictureDir = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
- bpictureDir.initWithPath(pDir.path);
-
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
- if (!fp) {
- dump("Unable to create file picker...\n");
- return;
- }
- fp.init(window, aimString("bibrowse.title"), Components.interfaces.nsIFilePicker.modeOpen);
- fp.appendFilter(aimString("bi.filetypes"), "*.gif;*.jpg;*.bmp;*.ico;*.xbm");
- var ret = fp.show();
- if (ret == Components.interfaces.nsIFilePicker.returnOK && fp.fileURL.spec) {
- var fileurl = fp.fileURL.spec;
- var Ifile = fp.fileURL.file;
- var filesize = Ifile.fileSize;
- if(filesize > 7168) {
- aimErrorBox(aimString("bi.toolarge"));
- return;
- }
- }
-
- //if the slected item is *my BI* then do this
- if ((level == 0) && (selectedItem == "*My Buddy Icon*") && (sindex == 0)) {
- pictureDir.append("picture.gif");
- if (pictureDir.exists()) {
- //delete the existing file
- pictureDir.remove(false);
- }
-
- Ifile.copyTo(pDir, "picture.gif");
- var anotherPictureDir = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
- anotherPictureDir.initWithPath(pDir.path);
- anotherPictureDir.append("picture.gif");
- if (anotherPictureDir.exists()) {
- var tfileurl = ioService.getURLSpecFromFile(anotherPictureDir);
- if (biimage) {
- //The picture.gif will be stored in cache. so everytime you click browse and change you image
- //the url remains the same and it loads from cache. That's the reason a unique value is used.
- biimage.setAttribute("src", tfileurl+"?foobar="+currentTime);
- }
- }
-
- try {
- pIAimSession.SetBuddyIcon(false);
- }
- catch(e) {
- dump("Error setting Buddy Icon...:" + e + "\n");
- }
- } //end of setting personal BI
- else {
- pictureDir.append("picture");
- if(!pictureDir.exists()) {
- return;
- }
- bpictureDir.append("picture");
- if(!bpictureDir.exists()) {
- return;
- }
-
- pictureDir.append(selectedItem+".gif");
- if (pictureDir.exists()) {
- //delete the existing one
- pictureDir.remove(false);
- }
-
- var newfileName = selectedItem + ".gif";
- Ifile.copyTo(bpictureDir, newfileName);
- bpictureDir.append(newfileName);
- if (!bpictureDir.exists()) {
- return;
- }
- var buddyBI = ioService.getURLSpecFromFile(bpictureDir);
- if (biimage) {
- //The picture.gif will be stored in cache. so everytime you click browse and change you image
- //the url remains the same and it loads from cache. That's the reason a unique value is used.
- biimage.setAttribute("src", buddyBI+"?foobar="+currentTime);
- }
-
-
- //this guy should set the reject flag in *defaulr-BI.rdf* (Not in Buddy List DS)
- // for this buddy so that the user won't receive BI from that remote Buddy.
- //this guy should also call the main RDF code to set the hasBI property.
- var rdf = aimRDF();
- var nimIM = aimIM();
- nimIM.SetHasBIBuddyIconFlag(selectedItem, true);
-
- var wantBIres = rdf.GetResource("http://home.netscape.com/NC-rdf#WantBI");
- var falseliteral = rdf.GetLiteral("false");
- nimIM.SetBuddyIconFlag(selectedItem, wantBIres, falseliteral);
-
- var nimBuddy = aimBuddyManager();
- nimBuddy.SetHasBuddyIconFlag(selectedItem, true);
-
- } //else
- }
-
- function GetIOService()
- {
- var IOService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
-
- return IOService;
- }
-
- function clearBuddyIcon()
- {
- var userresponse;
- userresponse = confirm(getString("bi.clearbi"));
- if (userresponse == false)
- return;
-
- var buddyTree = document.getElementById("buddyIconTree");
- var startIndex = {};
- var endIndex = {};
- buddyTree.treeBoxObject.selection.getRangeAt(0, startIndex, endIndex);
- var sindex = startIndex.value;
- var eindex = endIndex.value;
- var view = buddyTree.treeBoxObject.view;
- var level = view.getLevel(sindex);
- var selectedItem = view.getCellText(sindex, "ListSetupCol");
- var biimage = document.getElementById("buddyIconImage");
- var pIAimSession = pIIMManager.QueryInterface(Components.interfaces.nsIAimSession);
- var pDir = pIAimSession.profileDir;
-
- //set the image to current picture.gif
- var pictureDir = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
- pictureDir.initWithPath(pDir.path);
-
- if ((level == 0) && (selectedItem == "*My Buddy Icon*") && (sindex == 0)) {
- clearPersonalBuddyIcon();
- clearBuddyIconImage();
- return;
- }
-
- if ((level == 0) && (sidex > 0)) {
- //a group is selected
- return;
- }
-
- //three steps done.
- //1. Delete the <SN>.gif
- //2. Clear the RejectBI flag, if any.
- //3. Clear the HasBI flag, if any.
-
- pictureDir.append("picture");
- if (!pictureDir.exists()) {
- return;
- }
- pictureDir.append(selectedItem+".gif");
- if (pictureDir.exists()) {
- //remove the picture file
- pictureDir.remove(false);
- }
-
-
- var nimIM = aimIM();
- nimIM.SetHasBIBuddyIconFlag(selectedItem, false);
- var rdf = aimRDF();
-
- //clear wantBI flag
- var wantBIres = rdf.GetResource("http://home.netscape.com/NC-rdf#WantBI");
- var trueliteral = rdf.GetLiteral("true");
- nimIM.SetBuddyIconFlag(selectedItem, wantBIres, trueliteral);
-
- //clear reject BI flag
- var rejBIres = rdf.GetResource("http://home.netscape.com/NC-rdf#Reject");
- var falseliteral = rdf.GetLiteral("false");
- nimIM.SetBuddyIconFlag(selectedItem, rejBIres, falseliteral);
-
- //clear FileSize BI res
- var filesizeBIres = rdf.GetResource("http://home.netscape.com/NC-rdf#FileSize");
- var filesizeliteral = rdf.GetIntLiteral(0);
- nimIM.SetBuddyIconFlag(selectedItem, filesizeBIres, filesizeliteral);
-
- //clear checksum BI res
- var checksumBIres = rdf.GetResource("http://home.netscape.com/NC-rdf#CheckSum");
- var csliteral = rdf.GetIntLiteral(0);
- nimIM.SetBuddyIconFlag(selectedItem, checksumBIres, csliteral);
-
- var nimBuddy = aimBuddyManager();
- nimBuddy.SetHasBuddyIconFlag(selectedItem, false);
- nimBuddy.SetBuddyIconRejectFlag(selectedItem, false);
-
- clearBuddyIconImage();
-
- }
-
- function clearAllBuddyIcons()
- {
- var userresponse;
- userresponse = confirm(getString("bi.clearall"));
- if (userresponse == false)
- return;
-
- clearPersonalBuddyIcon();
- clearAllRemoteBuddyIcons();
- var nimIM = aimIM();
- nimIM.ClearAllBuddyIconFlags();
- clearBuddyIconImage();
-
- }
-
- /*clears all the remote buudies BI
- deletes the picture directory and creates an empty one ;-) */
- function clearAllRemoteBuddyIcons()
- {
- var pIAimSession = pIIMManager.QueryInterface(Components.interfaces.nsIAimSession);
- var pDir = pIAimSession.profileDir;
- var pictureDir = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
- pictureDir.initWithPath(pDir.path);
- pictureDir.append("picture");
- if ((pictureDir.exists()) && (pictureDir.isDirectory())) {
- var fileslist = pictureDir.directoryEntries;
- while(fileslist.hasMoreElements()) {
- var nextfile = fileslist.getNext().QueryInterface(Components.interfaces.nsIFile);
- if (nextfile && !nextfile.isDirectory())
- nextfile.remove(false);
- }
- }
- }
-
-
- /*Clears the personal Buddy Icon from the profilr directory and in COOL */
- function clearPersonalBuddyIcon()
- {
- var biimage = document.getElementById("buddyIconImage");
- var pIAimSession = pIIMManager.QueryInterface(Components.interfaces.nsIAimSession);
- var pDir = pIAimSession.profileDir;
- var pictureDir = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
- pictureDir.initWithPath(pDir.path);
- pictureDir.append("picture.gif");
- if (pictureDir.exists()) {
- //remove the image from the profile dir. clear the bi. send signal back to COOL.
- biimage.removeAttribute("src");
- pIAimSession.SetBuddyIcon(true);
- pictureDir.remove(false);
- }
- }
-
-
- function DisableBIElements()
- {
- document.getElementById("buddyIconTree").setAttribute("hidden", "true");
- document.getElementById("btnBrowseFile").setAttribute("disabled", "true");
- document.getElementById("btnClear").setAttribute("disabled", "true");
- document.getElementById("btnClearAll").setAttribute("disabled", "true");
- document.getElementById("acceptFromUsers").setAttribute("disabled", "true");
- document.getElementById("buddyKnockKnock").setAttribute("disabled", "true");
- document.getElementById("neverAccept").setAttribute("disabled", "true");
- document.getElementById("neverDisplay").setAttribute("disabled", "true");
- }
-
- function changeKnockKnock()
- {
- var displayBI = document.getElementById("displayBI").value;
- var kk = document.getElementById("buddyKnockKnock");
- if(displayBI == "0")
- kk.removeAttribute("disabled");
- else
- kk.setAttribute("disabled", "true");
- }
-
- function onBISelectionChange()
- {
- var buddyTree = document.getElementById("buddyIconTree");
- var startIndex = {};
- var endIndex = {};
- buddyTree.treeBoxObject.selection.getRangeAt(0, startIndex, endIndex);
- var sindex = startIndex.value;
- var eindex = endIndex.value;
- var view = buddyTree.treeBoxObject.view;
- var level = view.getLevel(sindex);
- var selectedItem = view.getCellText(sindex, "ListSetupCol");
-
-
- if ((level == 0) && (sindex > 0)) {
- //a group is selected. disable the buttons and clear the image.
- document.getElementById("btnBrowseFile").setAttribute("disabled", "true");
- document.getElementById("btnClear").setAttribute("disabled", "true");
- clearBuddyIconImage();
- return;
- }
- else {
- document.getElementById("btnBrowseFile").setAttribute("disabled", "false");
- document.getElementById("btnClear").setAttribute("disabled", "false");
- }
-
- if (sindex == 0) {
- LoadPersonalBuddyIcon();
- return;
- }
-
- if ((sindex >0) && (level != 0)) {
- //load the remote buddies buddy icon
- LoadRemoteBuddyBuddyIcon(selectedItem);
- }
-
- }
-
-
- /* As the name implies, this guy loads the buddy Icon of the remote buddy from the picture directory*/
- function LoadRemoteBuddyBuddyIcon(buddyname)
- {
- var pIAimSession = pIIMManager.QueryInterface(Components.interfaces.nsIAimSession);
- var pDir = pIAimSession.profileDir;
-
- //set the image to current picture.gif
- var pictureDir = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
- pictureDir.initWithPath(pDir.path);
- pictureDir.append("picture");
- if(!pictureDir.exists()) {
- return;
- }
- pictureDir.append(buddyname + ".gif");
- if (!pictureDir.exists()) {
- clearBuddyIconImage();
- return;
- }
-
- var ioService = GetIOService();
- var tfileurl1 = ioService.getURLSpecFromFile(pictureDir);
- //avoid loading from cache
- var currentTime = new Date().getTime();
- var biimage = document.getElementById("buddyIconImage");
- biimage.setAttribute("src", tfileurl1+"?foobar="+currentTime);
-
- return;
- }
-
- /*This just clears the image from the pref panel. */
- function clearBuddyIconImage() {
- var biimage = document.getElementById("buddyIconImage");
- biimage.removeAttribute("src");
- return;
- }
-
- /*This loads the personal Buddy Icon from the profile directory*/
- function LoadPersonalBuddyIcon() {
- var biimage = document.getElementById("buddyIconImage");
- var pIAimSession = pIIMManager.QueryInterface(Components.interfaces.nsIAimSession);
- var pDir = pIAimSession.profileDir;
-
- //set the image to current picture.gif
- var pictureDir = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
- pictureDir.initWithPath(pDir.path);
- pictureDir.append("picture.gif");
- if (pictureDir.exists()) {
- var ioService = GetIOService();
- var tfileurl1 = ioService.getURLSpecFromFile(pictureDir);
- //avoid loading from cache
- var currentTime = new Date().getTime();
- biimage.setAttribute("src", tfileurl1+"?foobar="+currentTime);
- }
- else {
- clearBuddyIconImage();
- }
- return;
- }
-
-
- function DisableAwayUI()
- {
- var el = document.getElementById("buttonAddMess");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("buttonEditMess");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("buttonRemoveMess");
- if ( el )
- el.setAttribute( "disabled", "true" );
- el = document.getElementById("AwayMessages");
- if ( el )
- el.setAttribute( "disabled", "true" );
- }
-
- function DiscardAwayChanges()
- {
-
- var IMServiceClass = Components.classes['@netscape.com/aim/IMManager;1'];
- var pIIMManager = IMServiceClass.getService(Components.interfaces.nsIIMManager);
- var pIAimString = pIIMManager.QueryInterface(Components.interfaces.nsIStringBundle);
-
- if ( pIAimString == undefined || pIAimString == null )
- return;
-
- var str = pIAimString.GetStringFromName( "away.exitmsg" );
- if (str == undefined || str ==null)
- return;
-
- alert( str );
- }
-
- function boottoggle(value)
- {
- parent.isBootEnabled = value;
- }
-
- function instantMessageOnOk()
- {
- var winhooksService = Components.classes["@mozilla.org/winhooks;1"].getService(Components.interfaces.nsIWindowsHooks);
- if (winhooksService) {
- if (parent.isBootEnabled)
- winhooksService.startupAddOption("-aim");
- else
- winhooksService.startupRemoveOption("-aim");
- }
- }
-
- function instantMessageOnload()
- {
- var todayhide = aimPrefsManager().GetBoolPref("aim.internal.hidetoday", null, false);
- if (todayhide)
- {
- document.getElementById("today").setAttribute("style", "display: none" );
- }
- if (navigator.platform != "Win32")
- {
- document.getElementById("boot").setAttribute("hidden", "true");
- // If all the elements in the Sign On group are removed, get ride of the groupbox
- // Otherwise we'll show an empty groupbox!
- if (todayhide)
- {
- document.getElementById("signongroup").setAttribute("style", "display: none" );
- }
- return;
- }
- if (!parent.hPrefWindow)
- {
- setTimeout("instantMessageOnload()", 1);
- return;
- }
- parent.hPrefWindow.registerOKCallbackFunc(instantMessageOnOk);
- if (!aimSession().CheckConflictRunKey())
- {
- var winhooksService = Components.classes["@mozilla.org/winhooks;1"].getService(Components.interfaces.nsIWindowsHooks);
- if (winhooksService) {
- parent.isBootEnabled = winhooksService.isOptionEnabled("-aim");
- document.getElementById("boot").checked = parent.isBootEnabled;
- }
- }
- else
- document.getElementById("boot").setAttribute("disabled", "true");
- }
-
-